<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<script type="text/javascript"
	src="http://api.map.baidu.com/api?v=3.0&ak=NEVPuaso46TGp6IAWEyvVnP75mdbGtX4"></script>
<script type="text/javascript" src="/js/jquery.min.js"></script>
<style type="text/css">
html {
	height: 100%
}

body {
	height: 100%;
	margin: 0px;
	padding: 0px
}

#container {
	width: 60%;
	height: 40%
}
</style>

</head>
<body>
	<div>
		<form action="../yogaclub/info" enctype="multipart/form-data"
			method="post">
			<input type="hidden" th:value="${coach.cimage}" name="cimage">
			头像：<input type="file" name="headImage"> <br> 昵称：<input
				type="text" name="cnickname" th:value="${coach.cnickname}"><br>
			姓名：<input type="text" name="cname" th:value="${coach.cname}"><br>
			性别： <input type="radio" name="csex" value="男">男 <input
				type="radio" name="csex" value="女">女<br> 电话：<input
				type="text" name="ctel" th:value="${coach.ctel}"><br>
			qq:<input type="text" name="cqq" th:value="${coach.cqq}"><br>
			年龄：<input type="text" name="cage" th:value="${coach.cage}"><br>
			邮箱：<input type="text" name="cmail" th:value="${coach.cmail}"><br>
			流派：<input type="text" name="cgenre" th:value="${coach.cmail}"><br>
			空闲时间：<input type="text" name="freetime" th:value="${coach.freetime}"><br>
			是否接课：<input type="radio" name="state" value="是">是 <input
				type="radio" name="" state"" value="否">否<br> 信息权限:<input
				type="radio" name="cpower" value="1">全部公开 <input
				type="radio" name="cpower" value="2">好友公开 <input
				type="radio" name="cpower" value="3">自己可见<br> <input
				type="submit" value="提交修改信息">
		</form>
	</div>
	<div id="container"></div>
	<div>
		<form action="../yogaclub/approve" enctype="multipart/form-data"
			method="post">
			身份证：<input type="text" name="cidcard" th:value="${coach.cidcard}"><br>
			地址：<input type="text" id="addr" name="caddrmes"><br>
			经纬度：<input type="text" id="jinwei" name="caddress"><br>
			自我介绍:<input type="text" name="describe" th:value="${coach.describe}"><br>
			<input type="submit" value="提交审核信息">
		</form>
	</div>

	<script type="text/javascript">
		$(document).ready(
<<<<<<< HEAD
<<<<<<< HEAD
				function() {
					//初始化地图
=======
				function() {
>>>>>>> refs/heads/zhangle
=======
				function() {
					//初始化地图
>>>>>>> refs/heads/muyonglin
					var map = new BMap.Map("container");
					var point = new BMap.Point(104.0699519292, 30.5790607666);
					map.centerAndZoom(point, 15);
<<<<<<< HEAD
<<<<<<< HEAD

					//滚轮
=======
>>>>>>> refs/heads/zhangle
=======

					//滚轮
>>>>>>> refs/heads/muyonglin
					map.enableScrollWheelZoom(true);
<<<<<<< HEAD
<<<<<<< HEAD

=======

>>>>>>> refs/heads/muyonglin
					//缩放控件
<<<<<<< HEAD
					map.addControl(new BMap.NavigationControl());
=======
					map.addControl(new BMap.NavigationControl()); //向地图中添加缩放控件
>>>>>>> refs/heads/zhangle
=======
					map.addControl(new BMap.NavigationControl());
>>>>>>> refs/heads/muyonglin
					var ctrlSca = new window.BMap.ScaleControl({
						anchor : BMAP_ANCHOR_BOTTOM_LEFT
					});
					//比例尺  
					map.addControl(ctrlSca);
					map.addControl(new BMap.MapTypeControl({
						mapTypes : [ BMAP_NORMAL_MAP, BMAP_SATELLITE_MAP,
								BMAP_HYBRID_MAP ]
<<<<<<< HEAD
<<<<<<< HEAD

					}));				
					//点击获取经纬度事件
=======
					}));
					show(map);
>>>>>>> refs/heads/zhangle
=======

					}));
					//点击获取经纬度事件
>>>>>>> refs/heads/muyonglin
					map.addEventListener("click", function(e) {
						var jinwei = e.point.lng + ", " + e.point.lat;
						$("#jinwei").val(jinwei);
					});
<<<<<<< HEAD
<<<<<<< HEAD

					//点击获取详细地址事件
=======
>>>>>>> refs/heads/zhangle
=======

					//点击获取详细地址事件
>>>>>>> refs/heads/muyonglin
					var geoc = new BMap.Geocoder();
					map.addEventListener("click", function(e) {
						var pt = e.point;
						geoc.getLocation(pt, function(rs) {
							var addComp = rs.addressComponents;
							var context = addComp.province + addComp.city
									+ addComp.district + addComp.street
									+ addComp.streetNumber;
							$("#addr").val(context);
						});
					});
					//初始化展示数据库内容
					show(map);
				});

		function show(map) {
			$.ajax({
				url : "/map/showcoach",
				type : "post",
				dataType : "json",
				success : function(data) {
					var myGeo = new BMap.Geocoder();
					for (var j = 0; j < data.length; j++) {
						var po = data[j].caddress;
						var pojo = data[j];
						var arr = po.split(",");
						var marker = new BMap.Marker(new BMap.Point(arr[0],
								arr[1]));
						map.addOverlay(marker);
						marker.setLabel(new BMap.Label(pojo.cname, {
							offset : new BMap.Size(20, -10)
						}));
						createTag(marker, pojo);
					}
				}
			});
		}
		function createTag(marker, m) {
			//标注
			var text = "<p>教练姓名："
					+ m.cname
					+ "</p><p>流派："
					+ m.cgenre
					+ "</p><p>地址："
					+ m.caddrmes
					+ "</p><p>详细资料:<a href='http://localhost:8080/coachmes.html?uid="
					+ m.uid + "'>点击查看</p>";
			//给标记添加点击事件以及显示窗口信息
			var infoWindow = new BMap.InfoWindow("<p style='font-size:14px;'>"
					+ text + "</p>");
			marker.addEventListener("click", function() {
				this.openInfoWindow(infoWindow);
			});
		}
	</script>
</body>
</html>